home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / AMOSList / AMOSLIST / text0093.txt < prev    next >
Encoding:
Text File  |  1998-04-01  |  1.1 KB  |  43 lines

  1. In response to...
  2. >> Ok how will do to make amos to understand that i want to threat this
  3. >> as a number instead of an ascii value?
  4. >Isnt this ASC ? or is this some other language thats bouncing round
  5. >my head!
  6.  
  7. >a=asc("5") sets a to 5 ????
  8.  
  9. I wrote...
  10.  
  11. >This is AMOS but does the opposite of what you are thinking.
  12. >It would set 'a' to the ASCII value of the string "5".
  13.  
  14. >What you want to use is VAL I think (although I have forgotten what you 
  15. were
  16. >originally trying to do now!).
  17.  
  18. >But, remembering bits, you were PEEKing a value from memory and trying to 
  19. do
  20. >some maths on the result...
  21.  
  22. >so a bit of your code is a=PEEK(start(16)) which returns the ASCII value of 
  23.  
  24. >"5", you need to convert the ASCII value to a string using CHR$, then
  25. >convert the string into a numeric...
  26.  
  27. >a=(VAL(CHR$(PEEK(Start(16)))
  28.  
  29. I have just remembered a function which could cut this down a bit...
  30.  
  31. a=(VAL(PEEK$(Start(16))
  32.  
  33. should do the same as above.
  34.  
  35. PEEK$ should return the value of the string at the location specified 
  36. instead of an ASCII value so you don't need to go on to do the CHR$() part.
  37.  
  38. >Wayne.
  39.  
  40.  
  41.  
  42.  
  43.